*******************************************************************************
******************************  TABLE A16  ************************************
*************************  Summary Statistics  ********************************
*******************************************************************************

clear all
set more off


//cd "C:/Users/ganth/Dropbox/StrengthInNumbersReplicationPackage/replicable/table_a16"

*******************************************************************************

**Sexism analysis

use "table_a16_dataset_1.dta", clear 

ttest hbs_s1 = hbs_s5 if female==0 & fem_leader==1
ttest hbs_s1 = hbs_s5 if female==0 & fem_leader==0

ttesti 208 .0277362 .1497414 221 .0279061 .1325703

ttest hbs_s1 = hbs_s5 if female==0 & condition_num==2
ttest hbs_s1 = hbs_s5 if female==0 & condition_num==4
ttesti 137 .0273617 .1335013 292 .0280405 .1445935


ttest hbs_s1 if female==0, by(condition_num)

ttest hbs_s1 = hbs_s5 if female==1 & fem_leader==1
ttest hbs_s1 = hbs_s5 if female==1 & fem_leader==0
ttesti 215 0.0274888 0.1415846 206 0.0563131 0.1424974


ttest hbs_s1 = hbs_s5 if female==1 & condition_num==2
ttest hbs_s1 = hbs_s5 if female==1 & condition_num==4
ttesti 278 0.0405364 0.1390047 143 0.0436466 0.1498057



**This replicates the t-test results but with cluster robust standard errors
replace byuid=byuid+"x" in 79
keep hbs_s1 hbs_s5 female fem_leader condition_num group_id byuid maleMajority
gen hbs_diff=hbs_s1-hbs_s5

reshape long hbs_, i(byuid) j(time, string)

ren hbs_ hbs
gen survey=1 if time=="s1"
replace survey=2 if time=="s5"
replace survey=3 if time=="diff"

*Men
reg hbs i.fem_leader if female==0 & time=="s1", cluster(group_id)


reg hbs i.survey if survey!=3 & female==0 & fem_leader==1, cluster(group_id)
margins survey

reg hbs i.survey if survey!=3 & female==0 & fem_leader==0, cluster(group_id)
margins survey

reg hbs i.survey##i.fem_leader if survey!=3 & female==0 , cluster(group_id)

*Women
reg hbs i.survey if survey!=3 & female==1 & fem_leader==1, cluster(group_id)
margins survey

reg hbs i.survey if survey!=3 & female==1 & fem_leader==0, cluster(group_id)
margins survey

reg hbs i.survey##i.fem_leader if survey!=3 & female==1 , cluster(group_id)


*Men
reg hbs i.survey if survey!=3 & female==0 & maleMajority==0, cluster(group_id)
margins survey

reg hbs i.survey if survey!=3 & female==0 & maleMajority==1, cluster(group_id)
margins survey

reg hbs i.survey##i.maleMajority if survey!=3 & female==0 , cluster(group_id)

*Women
reg hbs i.survey if survey!=3 & female==1 & maleMajority==0, cluster(group_id)
margins survey

reg hbs i.survey if survey!=3 & female==1 & maleMajority==1, cluster(group_id)
margins survey

reg hbs i.survey##i.maleMajority if survey!=3 & female==1 , cluster(group_id)


**Test men's baseline sexism in Study 1
use "table_a16_dataset_2.dta", clear
ttest hbs if female==0, by(maleMajority)
